package com.lht.designPattern.proxy.jdkProxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author Eric
 * @version 1.0
 * @date 2019-10-23
 */
public class DriverProxy implements InvocationHandler {

    private Driver driver;

    public DriverProxy(Driver driver) {
        this.driver = driver;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("-------------before------------");
        Object obj = method.invoke(driver, args);
        System.out.println("-------------after-------------");
        return obj;
    }
}
